#include <iostream>
#include <cstdio>
#include <stack> 
using namespace std;

const int N = 1e5 + 10;

stack<int> st;

int main(){
	int num = 0;
	while(char c = getchar()){
		if(c >= '0'&&c <='9'){
			num = num*10 + (c -'0');
		}
		else if(c == '.'){
			st.push(num);
			num = 0;
		}
		else if(c == '+'||c == '-'||c == '*'||c == '/'){
			int x,y;
			y = st.top();
			st.pop();
			x = st.top();
			if(st.size()){
				st.pop();
			}
			switch(c){
				case '+':st.push(x+y);break;
				case '-':st.push(x-y);break;
				case '*':st.push(x*y);break;
				case '/':st.push(x/y);break;
			}
		}
		else if(c == '@'){
			break;
		}
	}
	cout << st.top() << endl;
	return 0;
} 
